import React, {Component} from 'react';
import {observer} from 'mobx-react';
// import PropTypes from 'prop-types';

@observer
class TodoItem extends Component {

    handleClick = (e) => {
        let {todo} = this.props;
        todo.toggle();
    }

    render() {
        // 这里的Item是一个对象
        let {todo} = this.props;
        return (
            <div>
                <input
                    type="checkbox"
                    checked={todo.state.finished}
                    onChange={this.handleClick}
                />
                <span className="title">{todo.state.title}</span>
            </div>
        )
    }
}

export default TodoItem;
